/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package Modelo;

import utiles.configuration.ConfigurationParametersManager;

/**
 *
 * @author Jorge
 */
public class DaoAgendaFactory {
    private final static String DAO_CLASS_NAME_PARAMETER = "AgendaDaoFactory/daoClassName";

    private final static Class daoClass = getDAOClass();

    private DaoAgendaFactory(){}

    private static Class getDAOClass() {

	      Class theClass = null;

	      try {

	         String daoClassName = ConfigurationParametersManager.getParameter(DAO_CLASS_NAME_PARAMETER);

	         theClass = Class.forName(daoClassName);


	      }
	          catch (Exception e) {
	            e.printStackTrace();

	         }
	      return theClass;
	   }



	    public static DaoAgenda getDAO() throws Exception {

	      try {
	         return (DaoAgenda)daoClass.newInstance();
	      }
	          catch (Exception e) {
	            throw e;

	         }
        }


}
